﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using TiTi.tea.Api.Models;
using TiTi.tea.BLL;

namespace TiTi.tea.Api.Controllers
{
    [RoutePrefix("api/category")]
    public class CategoryController : ApiController
    {
        private CategoryBLL bll = new CategoryBLL();

        /// <summary>
        /// 获取全部分类
        /// </summary>
        /// <returns></returns>
        [Route("")]
        public Result GetAll()
        {
            return Result.Success(bll.GetAll());
        }

        /// <summary>
        /// 获取分类以及分类下的产品
        /// </summary>
        /// <returns></returns>
        [Route("GetCategoryProducts")]
        public Result GetCategoryProducts()
        {
            return Result.Success(bll.GetCategoryProducts());
        }
    }
}